# set library name
set(TARGET_LIB net)
add_definitions(-DMODULE_NAME=\"${TARGET_LIB}\") # for core/io.h

# include common setting
include(${CMAKE_CURRENT_SOURCE_DIR}/../CMakelists_common.txt)

# path setting
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../core/include)
set(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
FOREACH(MROVER_LIB core net png)
  set(MROVER_LIB_DIR ${MROVER_LIB_DIR} ${PARENT_DIR}/${MROVER_LIB}/lib)
ENDFOREACH(MROVER_LIB)
link_directories(${MROVER_LIB_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test_bin)

# load external libraries
#_load_eigen3_library()
_load_boost_library()

# build library
file(GLOB LIBNET_SRC src/*.cpp)
add_library(${TARGET_LIB} ${LIBNET_SRC})
target_link_libraries(${TARGET_LIB} core)

# build test code
add_executable(server_test test/server_test.cpp)
target_link_libraries(server_test ${TARGET_LIB})
add_executable(client_test test/client_test.cpp)
target_link_libraries(client_test ${TARGET_LIB})
add_executable(message_test test/message_test.cpp)
target_link_libraries(message_test ${TARGET_LIB})
